package acewem.utilities.test;

import org.apache.commons.math3.analysis.DifferentiableMultivariateVectorFunction;
import org.apache.commons.math3.analysis.MultivariateMatrixFunction;


public class QuadrOpt implements DifferentiableMultivariateVectorFunction{
	
	private double bR;
	private double aR;
	private double capR;
	private double E;
	
	public QuadrOpt(double aR, double bR, double capR, double E)
	{
		this.bR = bR;
		this.aR = bR;
		this.capR = capR;
		this.E = E;
	}


	
	private double[][] jacobian(double[] variables) {
		double[][] jacobian = new double[1][2];
	     for (int i = 0; i < jacobian.length; ++i) {
	         jacobian[0][0] = -capR *capR/2.0;
	         jacobian[0][1] = -capR;
	     }
	     return jacobian;
    }

    public double[] value(double[] variables) {
        double[] values = new double[1];

            values[0] = (variables[0] * capR + variables[1]) * capR;
        
        return values;
    }


    public MultivariateMatrixFunction jacobian() {
        return new MultivariateMatrixFunction() {
            private static final long serialVersionUID = -8673650298627399464L;
            public double[][] value(double[] point) {
                return jacobian(point);
            }
        };
    }

	

    }

















